package SEDay05;

import java.util.Scanner;
    /*需求：键盘录入一个整数作为数组的长度，随后再次键盘录入数据并将数组存满
    从数组中找出最小值，并将最小值打印在控制台*/
public class Subject2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入数组的长度：");
        int num = scanner.nextInt();
        int[] arr = new int[num];
        System.out.println("请输入数据：");
        for (int i = 0; i < arr.length; i++) {
            arr[i] = scanner.nextInt();
        }
        int min = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (min > arr[i]) {
                min = arr[i];
            }
        }
        System.out.println("最小值为"+min);
    }
}
